package com.xiaoxin.model.vo;

import com.xiaoxin.model.domain.UserInfo;
import com.xiaoxin.model.mongo.RecommendUser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @author xiaoxiaode
 * @date 2021-09-01-15:02
 **/

@Data
@AllArgsConstructor
@NoArgsConstructor
public class TodayBest  {
    private  Long id;
    private  String avatar;
    private  String nickname;
    private  String gender;
    private  Integer age;
    private  String[] tags;
    private  Long fateValue;//缘分值

    /*
    * 工具方法,封装转换过程
    * */
    public  static TodayBest init(UserInfo userInfo, RecommendUser recommendUser){
        TodayBest vo=new TodayBest();
        BeanUtils.copyProperties(userInfo,vo);
        if(userInfo.getTags()!=null){
            vo.setTags(userInfo.getTags().split(","));
        }
        vo.setFateValue(recommendUser.getScore().longValue());
        return  vo;
    }
 }
